Regex fix for this? [extension]

Posted by Yeti on Stack Overflow See other posts from Stack Overflow or by Yeti
Published on 2010-06-17T13:04:38Z Indexed on 2010/06/17 13:13 UTC
Read the original article Hit count: 436

Filed under:
|

Sorry for the redundancy, I should've asked this in my previous question here: http://stackoverflow.com/questions/3061407/whats-the-regex-to-solve-this-problem

This question is an extension:

From the elements in an array below:

http://example.com/apps/1235554/
http://example.com/apps/apple/
http://example.com/apps/126734
http://example.com/images/a.jpg

I'm separating out apps/{number}/ and apps/{number} using:

foreach ($urls as $url)
{
    if (preg_match('~apps/[0-9]~', $url)) echo $url;
}

Now, how do I also push {number} to another array with the same regex?

© Stack Overflow or respective owner

Related posts about php

Related posts about regex